From: Rui Matos Date: Sun, 9 Sep 2012 20:44:25 +0000 (+0200) Subject: status/keyboard: Handle IBus engines which don't specify a symbol X-Git-Tag: archive/raspbian/50.5-1+rpi1~1^2~1013^2^2~5883 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=409af28cb703b50dbd6860d2c27b2e1f9bd14b71;p=gnome-shell.git status/keyboard: Handle IBus engines which don't specify a symbol In this case, fall back to the 2 or 3 letter language code or, failing that, to a keyboard symbol. https://bugzilla.gnome.org/show_bug.cgi?id=683613 --- diff --git a/js/ui/status/keyboard.js b/js/ui/status/keyboard.js index 3dd7e3f5c..ce5824e42 100644 --- a/js/ui/status/keyboard.js +++ b/js/ui/status/keyboard.js @@ -245,7 +245,7 @@ const InputSourceIndicator = new Lang.Class({ info.exists = true; info.displayName = language + ' (' + engineDesc.get_longname() + ')'; - info.shortName = engineDesc.get_symbol(); + info.shortName = this._makeEngineShortName(engineDesc); } } @@ -320,6 +320,18 @@ const InputSourceIndicator = new Lang.Class({ Util.spawn(['gkbd-keyboard-display', '-l', description]); }, + _makeEngineShortName: function(engineDesc) { + let symbol = engineDesc.get_symbol(); + if (symbol && symbol[0]) + return symbol; + + let langCode = engineDesc.get_language().split('_', 1)[0]; + if (langCode.length == 2 || langCode.length == 3) + return langCode.toLowerCase(); + + return String.fromCharCode(0x2328); // keyboard glyph + }, + _containerGetPreferredWidth: function(container, for_height, alloc) { // Here, and in _containerGetPreferredHeight, we need to query // for the height of all children, but we ignore the results